#include<iostream>
#include<algorithm>
#include<iomanip>
using namespace std;
int n, m;
double arr[30];
int main()
{
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		double ma = -100;
		double mi = 100;
		double sum = 0;
		for (int j = 0; j < m; j++) {
			double a;
			cin >> a;
			sum += a;
			if (ma < a) {
				ma = a;
			}
			if (mi > a) {
				mi = a;
			}
		}
		sum = sum - ma - mi;
		arr[i] = sum / (m - 2);
	}
	sort(arr, arr + n);
	cout << fixed << setprecision(2) << arr[n - 1] << endl;
	return 0;
}